<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <!--引入axios组件-->
    <script src="js/axios.js"></script>
</head>
<body>
    <button onclick="getData()">使用axios发送请求</button>
</body>
</html>
<script>
    function getData(){
        console.log("调用api-------")
        axios.get('http://localhost:8081/api/product/new').then(resp=>{
            console.log(resp)
            console.log('响应码：',resp.data.code);
            console.log('数据：',resp.data.data);
        }).catch(err=>{
            console.log(err)
        });
    }
</script>